/**
 * Copyright (c) 2015 www.smarthome.com All rights reserved. <br />
 * 本软件源代码版权归xxxx公司,未经许可不得任意复制与传播.<br />
 *
 */
package com.smarthome.core.deviceManager.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.springframework.stereotype.Service;

import com.smarthome.base.service.ShEquipmentUserService;
import com.smarthome.core.deviceManager.EquipmentUserService;
import com.smarthome.domain.bean.ShEquipmentUser;
import com.smarthome.domain.vo.api.UserDeviceBean;
import com.smarthome.domain.vo.boss.DataGrid;
import com.smarthome.domain.vo.boss.PageHelper;

/**
 * 设备与用户对应关系service层
 * @author szc
 *
 */
@Service("equipmentUserService")
public class EquipmentUserServiceImpl implements EquipmentUserService {

    protected static Logger LOGGER;

    @Resource
    private ShEquipmentUserService shEquipmentUserService;
    

    /**
	 * 查询设备通信信息列表
	 * @param deviceSupplier
	 * @param page
	 * @return
	 */
    @Override
    public DataGrid dataGrid(ShEquipmentUser equipmentUser, PageHelper page) {
        return shEquipmentUserService.queryShEquipmentUserPage(equipmentUser, page);
    }

    /**
     * 新增数据
     */
    @Override
	public void add(ShEquipmentUser equipmentUser) {
    	shEquipmentUserService.saveOrUpdate(equipmentUser);
	}
    
    /**
     * 通过id主键，得到对象信息
     */
    @Override
	public ShEquipmentUser queryShEquipmentUserById(Long id) {
		return shEquipmentUserService.selectEntryById(id);
	}
    
    /**
     * 修改
     */
    @Override
	public void edit(ShEquipmentUser equipmentUser) {
    	shEquipmentUserService.saveOrUpdate(equipmentUser);
	}

    /**
     * 删除
     */
	@Override
	public void delete(Long id) {
		List<Long> ids = new ArrayList<Long>();
		ids.add(id);
		shEquipmentUserService.deleteByIds(ids.toArray(new Long[ids.size()]));
	}
	
	/**
	 * 得到信息list
	 * @param equipmentInfo
	 * @return
	 */
	public List<ShEquipmentUser> queryShEquipmentUserList(ShEquipmentUser equipmentUser){
		return shEquipmentUserService.selectEntryList(equipmentUser);
	}
	
	/**
	 * 得到用户的相关终端设备
	 * @param userDeviceBean
	 * @return
	 */
	public List<UserDeviceBean> queryUserDeviceBeanList(java.util.HashMap params){
		return shEquipmentUserService.queryUserDeviceBeanList(params);
	}
	
	
}
